﻿using System;
using System.Collections.Generic;
using System.Web;
using PayRoller.Code;
using System.Web.SessionState;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using HySoft.Cash.Business;
using HySoft.Cash.Structure;
using System.Configuration;
using System.Web.Profile;
using Huayou.Utils;

namespace PayRoller.Manage.RuleSet
{
    public class UserPwd : ParentPage, IRequiresSessionState
    {
        // Fields
        protected Button bnSave;
        protected HtmlForm form1;
        protected HtmlHead Head1;
        public string Sid = "";
        protected TextBox txtComfirmPwd;
        protected TextBox txtNewPwd;

        // Methods
        protected void bnSave_Click(object sender, EventArgs e)
        {
            TuserinfoBN obn = new TuserinfoBN(this.Page);
            TuserinfoDT detail = obn.Get(Convert.ToInt32(base.Request["Sid"]));
            detail.Password = Cipher.EncryptMD5(this.txtNewPwd.Text);
            obn.Edit(detail);
            obn.Dispose();
            obn = null;
            base.ClientScript.RegisterStartupScript(base.GetType(), "", "<script>alert('Success!');window.location='UserList.aspx';</script>");
        }

        protected override void OnInit(EventArgs e)
        {
            base.m_ModuleCode = "0011";
            base.CheckLogin(true);
            base.CheckPerm();
            base.OnInit(e);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.Sid = base.Request["Sid"].ToString();
            this.bnSave.Attributes.Add("onclick", "return Check1();");
        }

        // Properties
        protected HttpApplication ApplicationInstance
        {
            get
            {
                return this.Context.ApplicationInstance;
            }
        }

        protected DefaultProfile Profile
        {
            get
            {
                return (DefaultProfile)this.Context.Profile;
            }
        }
    }

}
